<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="shortcut icon" href="/favicon.ico"> <link href="/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/css/animate.min.css" rel="stylesheet">
    <link href="/css/style.min.css?v=4.0.0" rel="stylesheet">
	<!-- 搜索样式CSS-Start -->
	<link href="/common/css/searchStyle.css" rel="stylesheet">
	<!-- 搜索样式CSS-End -->
	<!-- 下拉 -->
	<link href="/css/plugins/chosen/chosen.css" rel="stylesheet">
</head>
<style type="text/css">
	.ruleInfo{
		width: 100%;
	}
	.ruleInfo table tr{
		display:inline-block;
		width: 50%;
		font-size: 18px;
		float: left;
	}
	.towTd{
		color:#6699ff;
	}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
    			<div class="ruleInfo">
    				<table>
    					<tr>
    						<td>消息阅读间隔时间:</td><td class="runTime towTd"></td>
    					</tr>
    					<tr>
    						<td>标题:</td><td class="title towTd"></td>
    					</tr>
    					<tr>
    						<td>备注:</td><td class="remark towTd"></td>
    					</tr>
    					<tr>
    						<td>key:</td><td class="key towTd"></td>
    					</tr>
    					<tr>
    						<td>value:</td><td class="value towTd"></td>
    					</tr>
    					<tr>
    						<td>类型:</td><td class="type towTd"></td>
    					</tr>
    					<tr>
    						<td>预警时间间隔 :</td><td class="rangeMinute towTd"></td>
    					</tr>
    					<tr>
    						<td>预警次数 :</td><td class="rangeCount towTd"></td>
    					</tr>
    					<tr>
    						<td>预警开始时间 :</td><td class="rangeStartTime towTd"></td>
    					</tr>
    					<tr>
    						<td>预警结束时间 :</td><td class="rangeEndTime towTd"></td>
    					</tr>
    					<tr>
    						<td>预警停止时间 :</td><td class="stopTime towTd"></td>
    					</tr>
    				</table>
					<!-- <span>通知距离现在时间：</span>
					<span>规则信息</span> -->
				</div>
        <div class="ibox-content">
            <div class="row row-lg">
                <div class="col-sm-12">
                    <!-- Example Events -->
                    <div class="example-wrap">
                        <table id="systemCompanyEmplTable">
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
	<!-- End Panel Other -->
	<script src="/js/jquery.min.js?v=2.1.4"></script>
	<script src="/js/bootstrap.min.js?v=3.3.5"></script>
	<script src="/js/content.min.js?v=1.0.0"></script>
	<script src="/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
	<script src="/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
	<script src="/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
	<script src="/common/petecat.js"></script>
	<script src="/common/bootstrap-table-treetable.js"></script>
	<script src="/common/bootstrap-table.js"></script>
	<script src="/common/form.js"></script>
	<!-- HTML之间的传值 -->
	<script src="/js/jquery.params.js"></script>
	<script src="/js/plugins/layer-pc/layer.js"></script>
	<script src="/js/jquery.cookie.js"></script>
    <!-- 组件通用 -->
    <script src="/common/frame.js"></script>
    <!-- 下拉 -->
	<script src="/js/plugins/chosen/chosen.jquery.js"></script>
<script type="text/javascript">
	var esId = GetQueryString("esId")
    $(function(){
        var table = {};
    	table['id'] = 'systemCompanyEmplTable';
    	table['url'] = BASE_URL+'/base/warningconfig/getWarningEmplByEsId?esId='+esId,
    	table['columns'] = [{
	    	 field:'userName',
	         title:'联系人名称'
			},{
	    	 field:'isEmail',
	         title:'邮箱权限',
	         formatter(value, row, index){
	        	 return icon_state(value);
	         }
			}
			,{
	    	 field:'isSms',
	         title:'短信权限',
	         formatter(value, row, index){
	        	 return icon_state(value);
	         }
			},{
	    	 field:'sms',
	         title:'SMS'
		    },{
	    	 field:'email',
	         title:'联系人邮箱'
	    	}];
    	initTable(table);
    	initRuleInfo(esId);
    });
	function icon_state(state){
		var pic_html = state == 0 ?"<div style='width:25px;height:25px;background:url("+"/common/images/icon_no.png"+") no-repeat 0 0;background-size:cover;'></div>":"<div style='width:25px;height:25px;background:url("+"/common/images/icon_yes.png"+") no-repeat 0 0;background-size:cover;'></div>";
		return pic_html;
	}
	//加载规则数据
	function initRuleInfo(){
		var req = {};
        req['reqJSON'] = {
            type : 'get',
            url : BASE_URL+'/base/warningconfig/getWarningRuleInfoByEsId?esId='+esId
        };
        req['useToken'] = true;
        req['successFn'] = function(respData){
           if(respData.code == SUCCESS_CODE){
        	   var config = respData.data;
        	   $(".key").text(config.keys);
        	   $(".value").text(config.value);
        	   var type = config.type;
        	   if(type== 0){
        		   type = "服务器信息";
        	   }else if(type== 1){
        		   type = "硬件";
        	   }else if(type== 2){
        		   type = "软件";
        	   }else if(type== 3){
        		   type = "应用";
        	   }else if(type== 4){
        		   type = "服务器状态";
        	   }else if(type== 5){
        		   type = "其他";
        	   }else if(type== 6){
        		   type = "串口";
        	   }
        	   $(".type").text(type);
        	   $(".rangeMinute").text(config.rangeMinute+"分");
        	   $(".rangeCount").text(config.rangeCount+"次");
        	   $(".rangeStartTime").text(config.rangeStartTime);
        	   $(".rangeEndTime").text(config.rangeEndTime);
        	   $(".title").text(config.topTitle);
        	   $(".remark").text(config.topRemark);
        	   var stopTime = config.stopTime;
        	   if(stopTime == null){	
        		   stopTime = "没有停止";
        	   }
        	   $(".stopTime").text(stopTime);
        	   $(".runTime").text(config.runTime);
           }else{
        	  layer.alert("服务器返回失败！",{icon:3});
           }
        };
        ajaxRequest(req);
	}
</script>
</body>
</html>